/**
 * 
 */
package com.hp.bon.sgw.domain;

import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * @author sunhaiy 能力信息字典表
 * 
 */
@Entity
@Table(name = "T_CAPABILITY_INFO")
public class CapabilityInfo {
	public static final int NumIdiographType_NONE = 0;
	public static final int NumIdiographType_ONE = 1;
	public static final int NumIdiographType_TWO = 2;

	private String capability;
	private String capabilityName;
	private String capabilityDesc;
	/**
	 * flowid：6位流程编码，格式为eeffff，描述所有运行在计费网中的业务流程
	 */
	private String flowID;
	private int priority;
	private Date priorityDate;
	private int timeoutWarning;// CCA超时时间
	private int timeoutDropMsg;// CCA超时丢弃时间,暂时未用到
	/**
	 * 0:不签名;1:单向签名;2:双向签名
	 */
	private int numIdiographType = NumIdiographType_NONE;
	private boolean ifKeyStat = false;// 是否开启关键字统计功能
	private String keyTags;// 统计关键字，已“,”分割
	/**
	 * 请求消息最大值
	 */
	private int maxReqSize = -1;

	/**
	 * 网元类型
	 * 
	 * @标识能力所属网元类型,如:OCS，VC，
	 */
	private String bonNeType;
	/**
	 * BON 数字签名开关：1表示启用，0表示禁止
	 */
	private int bonSign = 0;
	/**
	 * BON 加密开关：1表示启用，0表示禁止
	 */
	private int bonEncrypt = 0;

	@Id
	public String getCapability() {
		return capability;
	}

	public void setCapability(String capability) {
		this.capability = capability;
	}

	public String getCapabilityDesc() {
		return capabilityDesc;
	}

	public void setCapabilityDesc(String capabilityDesc) {
		this.capabilityDesc = capabilityDesc;
	}

	public int getPriority() {
		return priority;
	}

	public void setPriority(int priority) {
		this.priority = priority;
	}

	public Date getPriorityDate() {
		return priorityDate;
	}

	public void setPriorityDate(Date priorityDate) {
		this.priorityDate = priorityDate;
	}

	public int getTimeoutWarning() {
		return timeoutWarning;
	}

	public void setTimeoutWarning(int timeoutWarning) {
		this.timeoutWarning = timeoutWarning;
	}

	public int getTimeoutDropMsg() {
		return timeoutDropMsg;
	}

	public void setTimeoutDropMsg(int timeoutDropMsg) {
		this.timeoutDropMsg = timeoutDropMsg;
	}

	public String getKeyTags() {
		return keyTags;
	}

	public void setKeyTags(String keyTags) {
		this.keyTags = keyTags;
	}

	public boolean isIfKeyStat() {
		return ifKeyStat;
	}

	public void setIfKeyStat(boolean ifKeyStat) {
		this.ifKeyStat = ifKeyStat;
	}

	@Column(nullable = true)
	public String getFlowID() {
		return flowID;
	}

	public void setFlowID(String flowID) {
		this.flowID = flowID;
	}

	@Column(nullable = true)
	public String getCapabilityName() {
		return capabilityName;
	}

	public void setCapabilityName(String capabilityName) {
		this.capabilityName = capabilityName;
	}

	public int getMaxReqSize() {
		return maxReqSize;
	}

	public void setMaxReqSize(int maxReqSize) {
		this.maxReqSize = maxReqSize;
	}

	public int getNumIdiographType() {
		return numIdiographType;
	}

	public void setNumIdiographType(int numIdiographType) {
		this.numIdiographType = numIdiographType;
	}

	@Transient
	public Set<String> getKeyTagsSet() {
		Set<String> set = new HashSet<String>();
		if (this.keyTags != null && !"".equals(this.keyTags)) {
			set = new HashSet<String>(Arrays.asList(this.keyTags.split(",")));
		}
		return set;
	}
}
